package vn.fpt.fsoft.entities;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Entity County mapping with County table in database;
 * 
 * @author DinhTV
 */
@Entity
@Table(name = "County")
public class County implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 654911010266292297L;
	private int countyId;
	private Nation nation;
	private String countyName;
	private Set<Town> towns = new HashSet<Town>(0);
	private Set<GovOfficeRegion> govs=new HashSet<GovOfficeRegion>(0);
	/**
	 * Constructor of county
	 */
	public County() {
	}

	

	@Id
	@GeneratedValue
	@Column(name = "CountyId", unique = true, nullable = false)
	public int getCountyId() {
		return this.countyId;
	}

	public void setCountyId(int countyId) {
		this.countyId = countyId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NationId")
	public Nation getNation() {
		return this.nation;
	}

	public void setNation(Nation nation) {
		this.nation = nation;
	}

	@Column(name = "CountyName")
	public String getCountyName() {
		return this.countyName;
	}

	public void setCountyName(String countyName) {
		this.countyName = countyName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "county")
	public Set<Town> getTowns() {
		return this.towns;
	}

	public void setTowns(Set<Town> towns) {
		this.towns = towns;
	}


	@OneToMany(fetch=FetchType.LAZY,mappedBy="county")
	public Set<GovOfficeRegion> getGovs() {
		return govs;
	}



	public void setGovs(Set<GovOfficeRegion> govs) {
		this.govs = govs;
	}
	
}
